<template>
	<view >
		<scroll-view>
			<cover-image v-if="notice.thumb!=null&notice.thumb!=''" :src="imgRoot+notice.thumb" :data-src="imgRoot+notice.thumb"  @tap="preImage"></cover-image>
			<rich-text class="content" :nodes="notice.query"   ></rich-text>
		</scroll-view>
	</view>
</template>

<script>

	export default {
		data() {
			return {
				advName:'',
				imgRoot:this.$rootUrl,
				notice:{
					thumb:'',
					query:''
				}
			}
		},
	
		onLoad(e) {
			this.advName=e.name;
			
			uni.setNavigationBarTitle({
				title: e.name
			});
			this.loadNoticeInfo();
		},
		
		
		methods: {
			loadNoticeInfo() {
				var me = this;
				uni.request({
					url: me.$rootUrl + '/Adv/FindByName',
					data: {
						name: me.advName
					},
					method: 'GET',
					success(res) {
						if (res.data.success) {
							me.notice = res.data.data;
						} else {
							uni.showModal({
								content: '服务器错误!',
								showCancel: false
							});
						}
					},
					fail() {
						uni.showModal({
							content: me.connectionFailText,
							showCancel: false
						});
					}
				});
			},
			preImage(e) {
				var me=this;
				var srcs=e.currentTarget.dataset.src;
				
				uni.previewImage({
					urls: [srcs],
					current:0,
					longPressActions: {
						itemList: ['发送给朋友', '保存图片', '收藏'],
						success: function(data) {
							console.log('选中了第' + (data.tapIndex + 1) + '个按钮,第' + (data.index + 1) + '张图片');
						},
						fail: function(err) {
							console.log(err.errMsg);
						}
					}
				});
			},
		}
	} 
</script>
<style>
	
		
</style>
